<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function(Request $request) {
    return $request->user();
});

//==============================================================================
Route::any('/mytest', 'Admin\TestController@test'); //测试用
Route::group(['prefix' => 'sampleinfo/expire'], function() {
    Route::any('handle', 'Api\SampleInfoExpireController@handle'); //工器具到期短信提醒--循环列表(定时任务用)
    Route::any('sms', 'Api\SampleInfoExpireController@sms');       //工器具到期短信提醒 -- 发送短信
    Route::any('checkSms', 'Api\SampleInfoExpireController@checkSms');//工器具到期短信提醒 -- 检查发送中的短信状态
});
Route::group(['prefix' => config('constant.name_admin')], function() {
    Route::middleware('throttle:200,1')->any('itemData/uploadRes', 'Admin\ItemDataController@uploadRes');  //电学试验软件上传试验结果  //一分钟最多请求200次  throttle：节流阀
    Route::any('myApi/hb6303', 'Admin\MyApiController@hb6303');               //HB6303温湿度模块上传数据 --- HB6303 请求服务器
    Route::any('qingping/getData', 'Admin\QingPingController@getData');       //获取青萍温湿度气压计的数据 --- 宝塔面板执行的计划任务
    Route::any('qingping/getHisdata', 'Admin\QingPingController@getHisdata'); //获取指定青萍温湿度气压计的历史数据

    Route::any('myApi/getTemp', 'Admin\MyApiController@getTemp');                                 //获取HB6303温湿度模块的----温度
    Route::any('dataUpload/getTempHumPressure', 'Admin\DataUploadController@getTempHumPressure'); //  2680试验软件/安全帽试验软件 读取---温度、湿度、大气压力

    Route::any('LLJ_login', 'Admin\DataUploadController@LLJ_login');           //拉压力机 登录
    Route::any('LLJ_upload', 'Admin\DataUploadController@LLJ_upload');         //拉压力机 数据上传
    Route::any('AQM_login', 'Admin\DataUploadController@AQM_login');           //安全帽 登录
    Route::any('AQM_upload', 'Admin\DataUploadController@AQM_upload');         //安全帽 数据上传
    Route::match(['get','post'],'uploadRes2', 'Admin\ItemDataController@uploadRes2');           //斜面机箱 仪器 登录验证 + 上传数据
    Route::post('updateSmokeAlarm', 'Admin\MyApiController@updateSmokeAlarm'); //更新烟雾报警信息 VB软件请求的接口
    Route::match(['get','post'],'liUploadRes', 'Admin\DataUploadController@liUploadRes');           //斜面机箱 力学仪器 登录验证 + 上传数据

    /* 微信公众平台 */ // Route::any('weChat/interfaceCheck', 'Admin\WeChatController@interfaceCheck'); //接口配置信息验证
    /* 微信公众平台 */

});

Route::group(['prefix' => 'chu'], function() {
    Route::any('getSmokeStatus', 'Admin\MyApiController@getSmokeStatus'); //获取烟雾报警状态
    Route::group(['prefix' => config('constant.name_admin')], function() {
        Route::any('alidysmsKeySec', 'Admin\MyApiController@getDyKeySecret'); //获取阿里大于短信的key和secre
        Route::any('getToken', 'Api\ChuApiController@getToken'); //获取接口token
        Route::post('envAdd', 'Api\EnvInfoController@add'); //上传环境信息
        Route::get('env/lastNInfo', 'Api\EnvInfoController@lastNInfo'); //获取最近N次收到的温湿度气压
        Route::get('managers', 'Api\ManagerController@index'); //用户列表
        Route::middleware('apiToken')->group(function() {
            Route::get('socket', 'Api\SocketController@sock'); //获取最近一次收到的温湿度气压
            Route::get('env/lastInfo', 'Api\EnvInfoController@lastInfo'); //获取最近一次收到的温湿度气压
            //Route::get('env/lastNInfo/{num}', 'Api\EnvInfoController@lastNInfo'); //获取最近N次收到的温湿度气压
            Route::get('station/list', 'Api\StationController@list'); //工位列表
        });
    });
    Route::any('upSmsStatus', 'Admin\SmsController@upSmsStatus'); //更新短信的发送状态
    Route::get('timer', 'Api\TimerController@timer'); //计划任务，如果是局域网，做定时任务更新环境终端数据
});

//Route::group(['prefix' => 'cqyd'], function() {
//    Route::any('getItems', 'Api\CqydApiController@getItems');
//});


Route::any('getConclusionByRFID/{rfid}', 'Admin\MyApiController@getConclusionByRFID');                 //根据工器具id 获取工器具最近一次检测的结论  杭州工具柜厂家
Route::get('getDetailTestInfoByRFID/{rfid}/{date?}', 'Admin\MyApiController@getDetailTestInfoByRFID'); //根据工器具rfid 获取工器具的详细检测信息  杭州工具柜厂家

Route::get('updateExcelPos', 'Admin\MyApiController@updateExcelPos'); //根据工器具rfid 获取工器具的详细检测信息  杭州工具柜厂家

//第三方系统对接-风控调用接口
//Route::any('fxjdwebservice/outbound', 'Admin\ThirdController@autoData');

